//
//  YPInvestDetailSectionTwoView.m
//  ChengHuiTong
//
//  Created by KiVen on 15/11/3.
//  Copyright © 2015年 张文权. All rights reserved.
//

#import "YPInvestDetailSectionTwoView.h"
@implementation YPInvestDetailSectionTwoView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
//      投资进度
        UILabel * investmentProgressLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, (self.frame.size.height-20)/2, 80, 20)];
        investmentProgressLabel.text = @"投资进度:";
        investmentProgressLabel.font = [UIFont systemFontOfSize:13];
        investmentProgressLabel.textColor = kColor_greyAshTitleColor;
//        investmentProgressLabel.backgroundColor = [UIColor orangeColor];
        [self addSubview:investmentProgressLabel];
        
        
        for (int i = 0; i < 2; i++) {
            
            UILabel * lineLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, i*39.5f, SCREEN_WIDTH, .5)];
            lineLabel.backgroundColor = UIColorFromRGB(0xE2E2E2);
            [self addSubview:lineLabel];
            
        }
        
////       进度条
//        self.progessView = [[ProgessView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(investmentProgressLabel.frame), (self.frame.size.height-10)/2, 150, 10)];
////        [self.progessView setProportion:0.6084];
//        [self addSubview:self.progessView];
        
//        百分数
        self.numberProgressLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-10-60, (self.frame.size.height-20)/2, 60, 20)];
//        numberProgressLabel.backgroundColor = [UIColor orangeColor];
        self.numberProgressLabel.font = [UIFont systemFontOfSize:13];
        self.numberProgressLabel.textColor = kColor_greyAshTitleColor;
        [self addSubview:self.numberProgressLabel];
        
        
       _colourProgress = [[graduallyProgress alloc]initWithFrame:CGRectMake(CGRectGetMaxX(investmentProgressLabel.frame), (self.frame.size.height-10)/2, SCREEN_WIDTH-15-80-20-60, 8)];
        _colourProgress.layer.cornerRadius =5;
        _colourProgress.clipsToBounds = YES;
        _colourProgress.backgroundColor = UIColorFromRGB(0xe4e4e4);
        
        [_colourProgress initLayer];

        _colourProgress.progress  =.5;
       
        [self addSubview:_colourProgress];

        
    
    }
    return self;
}

- (void)receiveDetailModel:(YPInvestDetailModel *)detailModel;
{
    
    _colourProgress.progress = [detailModel.progress_bar floatValue]/100.0;

//    [self.progessView setProportion:[detailModel.progress_bar intValue]/100.0];
    self.numberProgressLabel.text =[NSString stringWithFormat:@"%@%%",detailModel.progress_bar];
}


@end
